#include"Line.h"

namespace OpenDrive {
	Line::Line(float s, const Point &startPosition, float heading, float length) :Geometry(s, startPosition, heading, length){}

	Line::~Line(){}

	void Line::calPosition(float step){
		float x = 0.0, y = 0.0;
		float sx = getStartPosition().getX();
		float sy = getStartPosition().getY();
		float length = getLength();
		for (float dis = 0.0; dis < length; dis += step) {
			cal_line_segment(x, y, sx, sy, dis, getHeading());
			Point p(x, y, getHeading(), getS() + dis);
			addPoint(p);
		}

	}
}